<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
    require_once("class.connectSQL.inc");
    
    //instancia da classe
    $banco = new connectSQL();
	$banco1 = new connectSQL();
	$banco2 = new connectSQL();
	$banco3 = new connectSQL();
	$banco4 = new connectSQL();
	if(isset($_POST["acao"])){
		
		if($_POST["acao"]=="A"){ 
			$sql = "UPDATE pgsobre set titulo = '".$_POST["titulo"]."',"
                                . " texto = '".$_POST["texto"]."'"
                                . " where cod = '".$_GET["id"]."'";
			//die($sql);
			
			$banco3->Generico($sql);
			//die($_POST["acao"]);
			$msg = "Alterado com sucesso";
		}
		
		}
		
		
?>

	<head>
	<?php include "head.php"; ?>
 <script>   
    function validar(form){
    if(form.marca.value == ''){
        alert("O campo Marca é obrigatório.");
        return false;
    }
   
    return true;
	}
  </script>
	</head>
	<body>
    	<!-- Header -->
        <div id="header">
            <?php include "sair.php"; ?>
            
            <!-- Header. Main part -->
            <div id="header-main">
                <div class="container_12">
                    <div class="grid_12">
                        <div id="logo">
                            <ul id="nav">
                                <li id="current"><a href="">Sobre</a></li>
                                
                            </ul>
                        </div><!-- End. #Logo -->
                    </div><!-- End. .grid_12-->
                    <div style="clear: both;"></div>
                </div><!-- End. .container_12 -->
            </div> <!-- End #header-main -->
            <div style="clear: both;"></div>
            <!-- Sub navigation -->
          
        </div> <!-- End #header -->
        
		<div class="container_12" align="center" >
        

            <div class="module">
                     <h2><span>Cadastro da Página Sobre</span></h2>
                        
                     <div class="module-body">
                         <form action="cadsobre.php?id=<?php echo $_GET["id"];?>"  onsubmit="return validar(this);" id="form" method="post">
                        
                            <p align="left">
                            
                            
                                
                                <input type="hidden" name="idpgsobre" id="idpgsobre" value="1" />
                                
                            </p>
                            
                            <?php
					 
					 	 	 $resultado = $banco2->Query("SELECT * FROM pgsobre where cod = '".$_GET["id"]."'");
							 foreach ($resultado as $resut){
								$titulo =  $resut['titulo'];
                                                                $texto =  $resut['texto'];
                                                                
                                                               
							 }
						 
				?>
                            
                            <p align="left">
                                <label>Título</label>
                                <input type="text" class="input-medium" id="titulo" name="titulo" value="<?php echo $titulo; ?>" />
                                
                            </p>
                            <p align="left">
                                <label>Descriçao</label>
                                <textarea cols="50" rows="40" name="texto"><?php echo $texto; ?></textarea>
                            </p>
                            
                            
                           <input type="hidden" name="acao" value="A" />
                            <fieldset>
                                <input class="submit-green" type="submit" value="Salvar" /> 
                                <input class="submit-gray"  type="reset" value="Cancelar" />
                            </fieldset>
                        </form>
                     </div> 
                      <!-- End .module-body -->
					 
                </div>  <!-- End .module -->
				<?php 
				if(isset($msg)){
				echo "<span class='notification n-success'>".$msg."</span>";
				}
				?>
				
				<?php
					 $resultado = $banco->Query("SELECT * FROM pgsobre  where cod = '".$_GET["id"]."'");
				?>
                     
        
                <!-- Example table -->
                <!-- End .container_12 -->
		
         
        <?php include "footer.php"; ?>
        
	</body>
</html>